package com.yanzhenjie.andserver.sample.controller.device;

import android.util.Log;

import com.yanzhenjie.andserver.annotation.GetMapping;
import com.yanzhenjie.andserver.annotation.RequestHeader;
import com.yanzhenjie.andserver.annotation.RequestMapping;
import com.yanzhenjie.andserver.annotation.RestController;
import com.yanzhenjie.andserver.sample.controller.base.BaseController;
import com.yanzhenjie.andserver.sample.controller.device.vo.DeviceVo;

/**
 * 作者: Tao
 * 日期: 2023/3/2
 * 时间: 11:41
 * 描述: 设备管理
 */
@RestController
@RequestMapping(path = "/api/devices")
public class DeviceController extends BaseController {


    private static final String QUERY_DEVICE_STATUS_PATH = "/api/devices/status";

    @GetMapping(path = "/status")
    DeviceVo queryDeviceStatus(@RequestHeader(name = "Cookie") String cookie) {

        checkSession(cookie, QUERY_DEVICE_STATUS_PATH);

        DeviceVo deviceVo = new DeviceVo();
        deviceVo.setSerial_no("M133052912294542067");
        deviceVo.setMac_str("c0:24:a1:cc:70");
        deviceVo.setFirmware_version("2.1.3");

        return deviceVo;
    }

    @Override
    protected void log(String msg) {
        Log.i("DeviceController", msg);
    }
}
